{include file='public/head2'}
<div id="main-page">
    <div class="wap">
        <div class="data-box p-2">
            <a href="{$_W['baseurl']}/index/sale/verifyerqr?id={$_GPC['id']}" class="btn btn-block btn-default mb-2">扫码绑定核销员(抖音扫码)</a>
            {foreach $users as $item}
            <div class="container br-10 bg-white p-2 mb-2">
                <div class="row">
                    <div class="col-2">
                        <img src="{$item['avatar']}" class="br-half" width="100%">
                    </div>
                    <div class="col-10 lh-15">
                        <h3 class="mt-1">{$item['nickname']}</h3>
                        <p class="fc-light">领券时间：{:date('Y-m-d H:i:s', $item['createtime'])}</p>
                    </div>
                </div>
                <div style="margin:0 -0.2rem">
                    <hr>
                </div>
                <div class="flex row">
                    <div class="p-2 container">
                        <button type="button" class="btn btn-block btn-red3 delverifyer" data-id="{$item['id']}">删除核销员</button>
                    </div>
                </div>
            </div>
            {/foreach}
        </div>
    </div>
    <script>
      $(function(){
          var page = {$page};
          var limit = {$limit};
          var count = {$count};
          var totalheight = $(document).height()-50;//定义一个总的高度变量
          
          $(window).scroll(function () {
              if(count<limit*page){
                  return false;
              }
              totalheight = parseFloat($(window).height()) + parseFloat($(window).scrollTop());//浏览器的高度加上滚动条的高度 
              if ($(document).height() <= totalheight){ //当文档的高度小于或者等于总的高度的时候，开始动态加载数据
                  page++;
                  $.get("{$_W['baseurl']}/index/salem/verifyer?id={$_GPC['id']}&page="+page+'&limit='+limit, function(res){
                      var data = $(res).find('.data-box').html();
                      $('.data-box').append(data);
                  });
              }
          });
          $('.delverifyer').on('click', function(){
              if(confirm('确认要删除吗？')){
                var that = $(this);
                $.post(
                    "{$_W['baseurl']}/index/sale/delverifyer",
                    {id: that.data('id')},
                    function(ret){
                        if(ret.code==0){
                            that.parent().parent().parent().remove();
                        }
                    }
                );
              }
          });
      });
  </script>
</div>
{include file='public/footer'}